package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 名品名店商品评价表
 * </p>
 *
 * @author cnswhy
 * @since 2020-10-01
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_shop_comment")
@ApiModel(value = "ShopComment", description = "名品名店商品评价表")
public class ShopComment implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "")
    @NotNull(message = "不能为空")
    @TableId(value = "id", type = IdType.AUTO)
    @Excel(name = "")
    private Long id;

    /**
     * 客户id
     */
    @ApiModelProperty(value = "客户id")
    @NotNull(message = "客户id不能为空")
    @TableField("customer_id")
    @Excel(name = "客户id")
    private Long customerId;

    /**
     * 产品id
     */
    @ApiModelProperty(value = "产品id")
    @NotNull(message = "产品id不能为空")
    @TableField("product_id")
    @Excel(name = "产品id")
    private Long productId;

    /**
     * 订单id
     */
    @ApiModelProperty(value = "订单id")
    @NotNull(message = "订单id不能为空")
    @TableField("order_id")
    @Excel(name = "订单id")
    private Long orderId;

    /**
     * 所属商户id
     */
    @ApiModelProperty(value = "所属商户id")
    @NotNull(message = "所属商户id不能为空")
    @TableField("merchant_id")
    @Excel(name = "所属商户id")
    private Long merchantId;

    /**
     * 商品评分 1-好评 2-中评 3-差评
     */
    @ApiModelProperty(value = "商品评分 1-好评 2-中评 3-差评")
    @TableField("score")
    @Excel(name = "商品评分 1-好评 2-中评 3-差评")
    private Integer score;

    /**
     * 评价内容
     */
    @ApiModelProperty(value = "评价内容")
    @Length(max = 1000, message = "评价内容长度不能超过1000")
    @TableField(value = "content", condition = LIKE)
    @Excel(name = "评价内容")
    private String content;

    /**
     * 查看次数
     */
    @ApiModelProperty(value = "查看次数")
    @TableField("view_num")
    @Excel(name = "查看次数")
    private Integer viewNum;

    /**
     * 点赞次数
     */
    @ApiModelProperty(value = "点赞次数")
    @TableField("like_num")
    @Excel(name = "点赞次数")
    private Integer likeNum;

    /**
     * 商家回复
     */
    @ApiModelProperty(value = "商家回复")
    @Length(max = 1000, message = "商家回复长度不能超过1000")
    @TableField(value = "merchant_reply", condition = LIKE)
    @Excel(name = "商家回复")
    private String merchantReply;

    /**
     * 评论图片列表
     */
    @ApiModelProperty(value = "评论图片列表")
    @Length(max = 2000, message = "评论图片列表长度不能超过2000")
    @TableField(value = "img_list", condition = LIKE)
    @Excel(name = "评论图片列表")
    private String imgList;

    /**
     * 是否匿名 0-否 1-是
     */
    @ApiModelProperty(value = "是否匿名 0-否 1-是")
    @TableField("is_anonymous")
    @Excel(name = "是否匿名 0-否 1-是")
    private Integer isAnonymous;

    /**
     * 评论时间
     */
    @ApiModelProperty(value = "评论时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @Excel(name = "评论时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime createTime;


    @Builder
    public ShopComment(
                    Long id, Long customerId, Long productId, Long orderId, Long merchantId, 
                    Integer score, String content, Integer viewNum, Integer likeNum, String merchantReply, String imgList, 
                    Integer isAnonymous, LocalDateTime createTime) {
        this.id = id;
        this.customerId = customerId;
        this.productId = productId;
        this.orderId = orderId;
        this.merchantId = merchantId;
        this.score = score;
        this.content = content;
        this.viewNum = viewNum;
        this.likeNum = likeNum;
        this.merchantReply = merchantReply;
        this.imgList = imgList;
        this.isAnonymous = isAnonymous;
        this.createTime = createTime;
    }

}
